package com.cuckoo.mall.thus.order.orderdetail;

import android.content.Context;

import com.bgn.baseframe.base.BasePresenterImpl;
import com.bgn.baseframe.network.HttpObserver;
import com.bgn.baseframe.network.bean.TDataBean;
import com.cuckoo.mall.javabean.Order;
import com.cuckoo.mall.network.ApiManager;


/**
 * MVPPlugin
 * 邮箱 784787081@qq.com
 */

public class OrderdetailPresenter extends BasePresenterImpl<OrderdetailContract.View> implements OrderdetailContract.Presenter {

    @Override
    public void getOrderDetailById(String order_number) {
        ApiManager.getOrderDetailById(order_number).subscribe(new HttpObserver<TDataBean<Order>>(mView) {
            @Override
            public void onSucceed(TDataBean<Order> value) {
                mView.whenGetOrderSucceed(value.getData());

            }

            @Override
            public void onDefeat(TDataBean<Order> value) {
                super.onDefeat(value);
                mView.whenLoadFaild(value.getMsg());
            }

            @Override
            public void onError(Throwable e) {
                super.onError(e);
                mView.whenLoadFaild(e.getMessage());
            }
        });
    }
}
